package hevs.eServices.client.object;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@SuppressWarnings("serial")
public class Item implements Serializable {
	
	
	// Attributs
	private int id;
	private String name;
	
	
	// Relation Attributs
	private Item parent;
	private List<Meter> listMeter = new ArrayList<Meter>();
	
	
	// Constructors
	public Item() {
		
	}

	public Item(int id, String name) {
		this.id = id;
		this.name = name;
	}


	// Getter - Setters
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
	// Relation Getters - Setters
	public Item getParent() {
		return parent;
	}

	public void setParent(Item parent) {
		this.parent = parent;
	}
	
	public List<Meter> getListMeter() {
		return listMeter;
	}

	public void setListMeter(List<Meter> listMeter) {
		this.listMeter = listMeter;
	}

	public void addMeter(Meter meter) {
		this.listMeter.add(meter);
		if(meter.getItem() != this) {
			meter.setItem(this);
		}
	}

}
